//Set ,Map ,Date 没处理 ，对象只是处理了数组
function deepClone(obj) {
  if (typeof obj != "object") {
    return obj;
  }
  let res = Array.isArray(obj) ? [] : {};
  for (let key in obj) {
    if (obj.hasOwnProperty(key)) {
      res[key] = deepClone(obj[key]);
    }
  }
  return res;
}

const b = {
  app: function () {},
  x: 1,
  y: "test",
  z: undefined,
  a: [1, 2, 3],
  b: { a: 2, c: { key: 123 } },
};
let a = deepClone(b);
console.log(a);
